import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '../src/assets/scss/style.scss'

// highlight代码高亮官方默认插件
import hljs from 'highlight.js'
import 'highlight.js/styles/github-dark.css'

// 图片查看器
import ElImageViewer from '@/components/imageViewer/index.vue'
ElImageViewer.install = function () {
  Vue.component(ElImageViewer.name, ElImageViewer)
}
Vue.use(ElImageViewer)

Vue.use(ElementUI, hljs)

Vue.config.productionTip = false

Vue.directive('highlight', (el)=> {
  let blockCode = el.querySelectorAll('pre code');
  blockCode.forEach((blockCode) => {
    hljs.highlightBlock(blockCode)
  })
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
